import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '名称',
    align: 'left',
    dataIndex: 'name'
   },
   {
    title: '编码',
    align: 'center',
    dataIndex: 'code'
   },
   {
    title: '产品ID',
    align: 'center',
    dataIndex: 'wmItemId_dictText'
   },
   {
    title: '规格',
    align: 'center',
    dataIndex: 'specification'
   },
   {
    title: '单位',
    align: 'center',
    dataIndex: 'unitOfMeasure_dictText'
   },
   {
    title: '批次号',
    align: 'center',
    dataIndex: 'batchNo'
   },
   {
    title: '数量',
    align: 'center',
    dataIndex: 'quantity'
   },
   {
    title: '产品物料标识',
    align: 'center',
    dataIndex: 'itemOrProduct_dictText'
   },
   {
    title: '阶数',
    align: 'center',
    dataIndex: 'level'
   },
   {
    title: '所有层级父节点',
    align: 'center',
    dataIndex: 'ancestors'
   },
   {
    title: '是否开启',
    align: 'center',
    dataIndex: 'enableFlag_dictText'
   },
   {
    title: '租户ID',
    align: 'center',
    dataIndex: 'tenantId'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '父级节点',
    field: 'pid',
    component: 'JTreeSelect',
    componentProps: {
      dict: "wm_contract_product,name,id",
      pidField: "pid",
      pidValue: "0",
      hasChildField: "has_child",
    },
  },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  {
    label: '编码',
    field: 'code',
    component: 'Input',
  },
  {
    label: '产品ID',
    field: 'wmItemId',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"wm_item,name,id"
     },
  },
  {
    label: '规格',
    field: 'specification',
    component: 'Input',
  },
  {
    label: '单位',
    field: 'unitOfMeasure',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"unit_of_measure"
     },
  },
  {
    label: '批次号',
    field: 'batchNo',
    component: 'Input',
  },
  {
    label: '数量',
    field: 'quantity',
    component: 'InputNumber',
  },
  {
    label: '产品物料标识',
    field: 'itemOrProduct',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"item_or_product"
     },
  },
  {
    label: '阶数',
    field: 'level',
    component: 'InputNumber',
  },
  {
    label: '所有层级父节点',
    field: 'ancestors',
    component: 'Input',
  },
  {
    label: '是否开启',
    field: 'enableFlag',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"enable_flag",
        type: "radio"
     },
  },
  {
    label: '租户ID',
    field: 'tenantId',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  name: {title: '名称',order: 1,view: 'text', type: 'string',},
  code: {title: '编码',order: 2,view: 'text', type: 'string',},
  wmItemId: {title: '产品ID',order: 3,view: 'list', type: 'string',dictTable: "wm_item", dictCode: 'id', dictText: 'name',},
  specification: {title: '规格',order: 4,view: 'text', type: 'string',},
  unitOfMeasure: {title: '单位',order: 5,view: 'list', type: 'string',dictCode: 'unit_of_measure',},
  batchNo: {title: '批次号',order: 6,view: 'text', type: 'string',},
  quantity: {title: '数量',order: 7,view: 'number', type: 'number',},
  itemOrProduct: {title: '产品物料标识',order: 8,view: 'list', type: 'string',dictCode: 'item_or_product',},
  level: {title: '阶数',order: 9,view: 'number', type: 'number',},
  ancestors: {title: '所有层级父节点',order: 10,view: 'text', type: 'string',},
  enableFlag: {title: '是否开启',order: 11,view: 'radio', type: 'string',dictCode: 'enable_flag',},
  tenantId: {title: '租户ID',order: 12,view: 'text', type: 'string',},
};


/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
